/**      
 * @file		promotion.cpp
 * @description		Demonstrates promotion/demotion of integral
 *			data types to match parameter data types
 * @course		CSCI 123 Section 00000
 * @assignment		Lecture 4 - Sample 6
 * @date		mm/dd/yyyy	
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		1.0
 */
#include <iostream>
using namespace std;

// function documentation left out for brevity
int maximum(int d1, int d2, int d3);

/**
 * @return zero if the application executes successfully
 */
int main() {
	double mainD1 = 0.0;
	double mainD2 = 4.5;
	double mainD3 = 1.3;
	cout << "Max is " << maximum(mainD1, mainD2, mainD3) << endl;

	char mainChar1 = 65;
	char mainChar2 = 33;
	char mainChar3 = 100;
	cout << "Max is " << maximum(mainChar1, mainChar2, mainChar3) << endl;

	int mainInt1 = 2;
	int mainInt2 = -22;
	int mainInt3 = 100;
	cout << "Max is " << maximum(mainInt1, mainInt2, mainInt3) << endl;
	
	cout << "Max is " << maximum(33-22, 12/4, 144/6) << endl;
	return 0;
}

/************************************************************************/
/* Demonstrates another way of writing maximum with multiple returns    */
/************************************************************************/
int maximum(int d1, int d2, int d3) {
	int max = d1;
	if(d1 < d2) {
		max = d2;
	}
	if(max < d3) {
		return d3;
	}
	return max;
}
